
#include <iostream>
#include <algorithm>
#include <vector>

#include "Timer.hpp"
#include "ExpressionTemplates.hpp"

struct bob
{
  bob () : change( 5 )  {}
  bob ( int change_ ) : change( change_ )  {}

  int change;
};

struct hand_written
{
  int operator () ( int var )
  {
    return (var * var * var * var * var + 1) * var;
  }
};


int main ( void )
{
  using namespace E;

  // -------
  std::vector<int> ints( 88888888, 33 );
  std::vector<int> results( 88888888 );

  SD::Timer t_man;

  t_man.Start();
  std::transform( ints.begin(), ints.end(), results.begin(), (_1 * _1 * _1 * _1 * _1 + 1) * _1 );
  double f = t_man.TimeElapsed();
  std::cout << "expr templates: " << f << std::endl;

  t_man.Start();
  std::transform( ints.begin(), ints.end(), results.begin(), hand_written() );
  f = t_man.TimeElapsed();
  std::cout << "custom functor: " << f << std::endl;

  int stall;
  std::cin >> stall;
  // -------
  std::cout << (_1 * 5)(99) << std::endl;

  // -------
  //int* inty = new int(44);
  //std::cout << (_p1 * 2)(inty) << std::endl;

  return 0;
}
